package com.msc.cili.repository.config;/*
package com.msc.cili.web.config;


import com.alibaba.druid.pool.DruidDataSource;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;

import javax.sql.DataSource;

*/
/**
 * @author 骑蜗牛的羊
 * @date 2023/4/12 21:34
 * <p></p>
 *//*

@Configuration
@MapperScan(basePackages = InfoDBConfig.PACKAGE, sqlSessionFactoryRef = "infoSqlSessionFactory")
public class InfoDBConfig {

    static final String PACKAGE = "com.msc.cili.web.dao";
    static final String MAPPER_LOCATION = "classpath:/mapper/**Mapper.xml";

    @Value("${info.datasource.url}")
    private String url;

    @Value("${info.datasource.username}")
    private String username;

    @Value("${info.datasource.password}")
    private String password;

    @Value("${info.datasource.maxActive}")
    private int maxActive;

    @Value("${info.datasource.testWhileIdle}")
    private boolean testWhileIdle;

    @Value("${info.datasource.driverClassName}")
    private String driverClassName;

    @Bean(name = "infodbDataSource")
    public DataSource infodbDataSource() {
        DruidDataSource crDataSource = new DruidDataSource();
        crDataSource.setUrl(url);
        crDataSource.setUsername(username);
        crDataSource.setPassword(password);
        crDataSource.setMaxActive(maxActive);
        crDataSource.setTestWhileIdle(testWhileIdle);

        crDataSource.setDriverClassName(driverClassName);
        return crDataSource;
    }

    @Bean(name = "infodbTransactionManager")
    public DataSourceTransactionManager infodbTransactionManager() {
        return new DataSourceTransactionManager(infodbDataSource());
    }

    @Bean(name = "infoSqlSessionFactory")
    public SqlSessionFactory infodbSqlSessionFactory(@Qualifier("infodbDataSource") DataSource infodbDataSource)
            throws Exception {
        final SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
        sessionFactoryBean.setDataSource(infodbDataSource);
        sessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(InfoDBConfig.MAPPER_LOCATION));
        // 增加sql执行的拦截器
//        Interceptor[] plugins = new Interceptor[]{ myBatisExtendsInterceptor };
//        sessionFactoryBean.setPlugins(plugins);
        return sessionFactoryBean.getObject();
    }
}*/
